﻿using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using CodeStash.Common.DataAccess.UnitOfWork;
using System.ComponentModel.Composition;

namespace CodeStash.Common.DataAccess.EntityFramework
{

    public class ApplicationSettings
    {
        [Export("EFConnectionString")]
        public string ConnectionString
        {
            get { return "name=CodeStashEntities"; }
        }
    }



    [Export]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public partial class CodeStashEntities : EfDataContextBase, IUnitOfWork
    {
        [ImportingConstructor()]
        public CodeStashEntities(
            [Import("EFConnectionString")]
            string connectionString) : base(connectionString)
        {
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.LazyLoadingEnabled = true;
        }

        
        public DbSet<CodeCategory> CodeCategories { get; set; }
        public DbSet<CodeSnippet> CodeSnippets { get; set; }
        public DbSet<CodeTag> CodeTags { get; set; }
        public DbSet<CreatedTeam> CreatedTeams { get; set; }
        public DbSet<Grouping> Groupings { get; set; }
        public DbSet<Language> Languages { get; set; }
        public DbSet<OwnedTeam> OwnedTeams { get; set; }
        public DbSet<Visibility> Visibilities { get; set; }
        public DbSet<CodeSnippetForumMessage> CodeSnippetForumMessages { get; set; }
    }

}